package com.Liux.blog.controller;

import com.Liux.blog.entity.Comments;
import com.Liux.blog.service.CommentsService;
import com.Liux.blog.vo.ResultStatus;
import com.Liux.blog.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/comments")
public class CommentsController {

    @Autowired
    private CommentsService commentsService;

    @PostMapping("/insert")
    public ResultVo insertComments(Comments comments){
        int i = commentsService.createComments(comments);
       if(i>0){
           return new ResultVo(ResultStatus.OK,"评论成功",null);
       }else{
           return new ResultVo(ResultStatus.NO,"评论失败",null);
       }
    }

}
